package com.huidao.servlet.buyer;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.huidao.entity.Order;
import com.huidao.service.OrderService;
import com.huidao.service.OrderServiceImp;


public class UpdateorderServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       

    public UpdateorderServlet() {

    }


	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		System.out.println("付款");
		String state = request.getParameter("state");
		int order_state=0;
		if(state!=null){
			order_state=Integer.parseInt(state);
		}
		Order order = new Order();
		order.setOrder_state(order_state);
		order.setOrder_id(Long.parseLong(request.getParameter("id")));
		OrderService os = new OrderServiceImp();
		String data = os.updateOrder(order);
		if (data=="") {
			response.sendRedirect("GetListorderServlet");
		}else{
			response.getWriter().print(data);
		}
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		this.doGet(request, response);
	}

}
